<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>cfq security</title>
	<link rel="stylesheet"
	          href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
</head>

<body>
	<div class="container">
	    <div class="col-sm-12">
	        <h1>Spring Security SSO client-c</h1>
	        Welcome，<span id="principal"></span>
	    </div>
	    <div class="col-sm-12">
	        <button class="btn btn-primary" id="test1">异步获取8881端口test接口数据</button>
	        <button class="btn btn-primary" id="test2">异步获取8882端口test接口数据</button>
			<button class="btn btn-primary" id="logout">退出</button>
	    </div>
	</div>
	

<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="js/login.js"></script>
<script>
    
    $(function () {
		$('#principal').text(sessionStorage.getItem("username")+"/"+sessionStorage.getItem("nickname"))
		
		$('#test1').click(function(){
			$.ajax({
				url:'http://localhost:8881/test',
				headers: {
					'Authorization': 'bearer '+access_token
				},
				success:function(data){
					alert(data);
				}
			})
		})
		
		$('#test2').click(function(){
			$.ajax({
				url:'http://localhost:8882/test',
				headers: {
					'Authorization': 'bearer '+access_token
				},
				success:function(data){
					alert(data);
				}
			})
		})
		
    });
</script>
</body>
</html>